package com.mobimagic.lockscreen.util;

/**
 * @file FastDoubleClickUtils.java
 *
 * @author liule-ms
 *
 * @date 2014-6-13 下午1:33:50
 *
 * @description 判断是否是连续快速点击两次
 */
public class FastDoubleClickUtils {

    private static long lastClickTime;

    /**
     * 快速点击，时间间隔小于800ms
     *
     * @return
     */
    public synchronized static boolean isFastDoubleClick() {
        long time = System.currentTimeMillis();
        long timeD = time - lastClickTime;
        if (timeD > 0 && timeD < 800) {
            return true;
        }
        lastClickTime = time;
        return false;
    }

    /**
     * 正常点击，时间间隔大于800ms
     *
     * @return
     */
    public synchronized static boolean isNormalClick() {
        long time = System.currentTimeMillis();
        long timeD = time - lastClickTime;
        if (timeD > 800) {
            lastClickTime = time;
            return true;
        }
        return false;
    }
}
